#ifndef HISTOGRAMME_H
#define HISTOGRAMME_H

#include <QImage>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QComboBox>
#include <iostream>
#include <QObject>
#include <QColor>
#include "Histogram/ui_histo_diagram.h"
#include "Histogram/ui_histo_recadrer.h"
#include "Histogram/ui_Histo_binarisation.h"

class PImage;


enum e_histo{
    Affichage,
    Egalisation,
    Etalement,
    Recadrage,
    Binarisation

};


//this class create the RGB color histogram
class Histogramme : public QObject
{
    Q_OBJECT
public slots:
    void drawHistogram(int tabParamRed[256] = NULL,int tabParamGreen[256]= NULL,int tabParamBlue[256]= NULL,int tabParamRGB[256]=NULL);
    //**********EGALIZATION***************
    void egalize();
    void updateEgalize();
    //**********SPREAD(ETALER)************
    void spread();
    void updateSpread();
    //**********SHIFT(RECADRER)***********
    void shift(int luminosite);
    void updateShift();
    //**********BINARIZATION**************
    void seuilMinBin(int seuilMin);
    void seuilMaxBin(int seuilMax);
    void updateBinarisation();


public:
    Histogramme(QImage* image, e_histo typeHisto, PImage* pimg);


private:
    QImage* image;
    PImage *pimage;

    int tabRGB[256];
    int tabRed[256];
    int tabGreen[256];
    int tabBlue[256];

    Ui_Histo::Dialog* ui_Histo;
    Ui_HistoRecadrage::Recadrage* ui_HistoRecadrage;
    Ui_HistoBinarisation::Binarisation* ui_HistoBin;

    e_histo typeHisto;

    //**********EGALIZATION***************
    int tabRedCumul[256];
    int tabGreenCumul[256];
    int tabBlueCumul[256];

    //**********SHIFT(RECADRER)***********
    int redShift;
    int greenShift;
    int blueShift;
    int luminosite;

    //**********BINARIZATION**************
    int seuilMin;
    int seuilMax;

    //**********SPREAD(ETALER)************
    int aRed;
    int aGreen;
    int aBlue;

    int bRed;
    int bGreen;
    int bBlue;

};

#endif // HISTOGRAMME_H
